package com.reider.log4AS3
{
	import com.reider.log4AS3.interfaces.ILogger;
	import com.reider.log4AS3.manager.LogManager;
	
	/**
	 * This class can be used to get Logger instances or to set special values.
	 * 
	 *  @example Basic usage:<listing version="3.0">
	import com.reider.log4AS3.Logger;
	import com.reider.log4AS3.LoggerFactory;
	import com.reider.log4AS3.appenders.ConsoleAppender;
	  
	private static var log:Logger = LoggerFactory.getLogger(Main);
	
	log.info("This is an info level log");
	 *    </listing>
	 *
	 *  @langversion ActionScript 3.0
	 * 	@playerversion Flash 9.0  
	 * 
	 */
	
	public class LoggerFactory
	{
		/**
		 * A Boolean value indicating whether logging is enabled.
		 * Must be set before logging starts.
		 * 
		 * @default true
		 */
		 
		public static function get logManager():LogManager
		{
			return LogManager.getInstance()
		}
		
		public static function get logEnabled():Boolean
		{
			return logManager.logEnabled
		}
		
		public static function set logEnabled(value:Boolean):void
		{
			logManager.logEnabled = value
		}
		
		/**
		 * The url of the configuration xml.
		 * Must be set before logging starts.
		 * 
		 * @default logback.xml
		 */
		 
		public static function get logConfigURL():String
		{
			return logManager.logConfigURL
		}
		
		public static function set logFileURL(value:String):void
		{
			logManager.logConfigURL = value
		}
		
		
		/**
		 * @private
		 */
		
		public function LoggerFactory()
		{
			throw new Error("LoggerFactory is a static class")
		}
		
		//--------------------------------------------------------------------------
	    //
	    //  Static methods
	    //
	    //--------------------------------------------------------------------------
		
		/**
		 * Returns a new Logger instance
		 * 
		 * @param logTarget The target of the Logger. Can be a String or a Class or an instance of a Class.
		 */
		
		public static function getLogger(logTarget:Object):Logger
		{	
			return logManager.getLogger( logTarget )
		}
	}
}